package pack;

import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {
		ArrayList<Caissier> caissiers = new ArrayList<Caissier>();
		ArrayList<Caisse> caisses = new ArrayList<Caisse>();
		ArrayList<Client> clients = new ArrayList<Client>();
		
		Rayon rayonBigMac = new Rayon("bigMacs");
		Rayon rayonFrite = new Rayon("frites");
		
        Preparateur  paf = new Preparateur(1,rayonFrite);
        Preparateur  pa1 = new Preparateur(2,rayonBigMac);
        Preparateur  pa2 = new Preparateur(3,rayonBigMac);
        paf.start();
        pa1.start();
        pa2.start();
        
		for (int i = 0; i < 4; i++) {
			caisses.add(new Caisse(i));
			clients.add(new Client(i, caisses.get(i)));
			caissiers.add(new Caissier(i, caisses.get(i), rayonBigMac, rayonFrite));
		
			caissiers.get(i).start();
			clients.get(i).start();
			
		}
		
        
		
        try {
            for (int i=0;i<4;i++ ) {
            	clients.get(i).join();
            	caissiers.get(i).join();
            }
            paf.join();
            pa1.join();
            pa2.join();
          } catch(InterruptedException e) {
            e.printStackTrace();
          }

	}

}
